package day5.string;

/**
 * @author joker
 * @date 2022/4/15 0015 - 15:11
 */
public class StringTest {
    public static void main(String[] args) {
//        String s1="abc";
//        String s2=new String("abc");
//        String s3=new String("abc");
//        System.out.println(s1==s3);
//        System.out.println(s1.equals(s3));
//        s1=s3;
//        System.out.println(s1==s3);
//        System.out.println(s1.equals(s3));
        String s1 = "javaEE";
        String s2 = "hadoop";

        String s3 = "javaEEhadoop";
        String s4 = "javaEE" + "hadoop";
        String s5 = s1 + "hadoop";
        String s6 = "javaEE" + s2;
        String s7 = s1 + s2;
        String s8=(s1+"hadoop").toString();
        String s9=(s1+"hadoop").intern();


        System.out.println(s3 == s4);//true
        System.out.println(s3 == s5);//false
        System.out.println(s3 == s6);//false
        System.out.println(s3 == s7);//false
        System.out.println(s5 == s6);//false
        System.out.println(s5 == s7);//false
        System.out.println(s6 == s7);//false
        System.out.println(s3 == s8);
        System.out.println(s7 == s8);
        System.out.println(s3 == s9);

    }
}
